#!/bin/bash
#backupSchoolDatabase

if [ -z "$1" ];then
        echo 'ERROR! backupDatabase必要参数不能为空！参数要求: schoolCode'
        exit -1;
fi
schoolCode=$1
podName=`kubectl get pod | grep -i "$schoolCode"-mysql | awk '{print $1}'`
test -z "$podName" && echo "$schoolCode 's mysql not found" && exit -1
#echo $podName
kubectl exec $podName /bin/bash /usr/local/data/backupAllDbs.sh
test $? == 0 && echo "SUCCESS"